package com.cwl.pattern.迭代器模式;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: pattern
 * @description: 具体的聚合
 * @author: ChenWenLong
 * @create: 2019-07-10 11:18
 **/
public class ConcreteAggregate implements Aggregate {

    private List<Object> list=new ArrayList<Object>();

    @Override
    public void add(Object obj) {
        list.add(obj);
    }

    @Override
    public void remove(Object obj) {
        list.remove(obj);
    }

    @Override
    public Iterator getIterator() {
        return(new ConcreteIterator(list));
    }
}
